package com.iceland.common.strategy;


import java.util.HashMap;
import java.util.Map;

/**
 * 消息策略工厂
 */
public class CmdStrategyFactory {

    private static Map<Integer,CmdStrategy> strategyMap;

    public static CmdStrategy getStrategy(int type) {
        return strategyMap.get(type);
    }

    /**
     * 添加策略
     * @param cmdStrategy
     */
    public static void addCmdStrategy(CmdStrategy cmdStrategy){
        if(strategyMap==null){
            strategyMap=new HashMap<>();
        }
        strategyMap.put(cmdStrategy.getType(),cmdStrategy);
    }
}
